package com.cskaoyan.servlet;

import com.cskaoyan.bean.MarketCoupon;
import com.cskaoyan.bean.common.BaseRespVo;
import com.cskaoyan.bean.common.CommonData;
import com.cskaoyan.service.AdminFootprintService;
import com.cskaoyan.service.AdminFootprintServiceImpl;
import com.cskaoyan.util.ResponseUtil;
import com.cskaoyan.util.StringUtil;
import lombok.SneakyThrows;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


//小组接口会员足迹的实现

@WebServlet("/admin/footprint/*")
public class AdminFootprintServlet extends WdBaseServlet {

    AdminFootprintService adminFootprintService =new  AdminFootprintServiceImpl();
    @SneakyThrows
    private void list(HttpServletRequest request, HttpServletResponse response){




        Integer userId = StringUtil.isEmpty(request.getParameter("userId")) ? null : Integer.parseInt(request.getParameter("userId"));
        Integer goodsId = StringUtil.isEmpty(request.getParameter("goodsId")) ? null : Integer.parseInt(request.getParameter("goodsId"));


        Integer page = Integer.parseInt(request.getParameter("page"));

        Integer limit = Integer.parseInt(request.getParameter("limit"));

        String sort = request.getParameter("sort");
        String order = request.getParameter("order");

        CommonData<MarketCoupon> commonData = adminFootprintService.list(userId, goodsId,  page, limit, sort, order);

        ResponseUtil.responseJson(response, BaseRespVo.ok(commonData));





    }


}
